<% title "New project selection" %>

<% content_for :head do %>
  <%= render(:partial => "shared/import_tablesorter") %>
  <script type="text/javascript">
    $(document).ready(function() {
      $("#projects")
      .tablesorter({sortList: [[2, 0]], widthFixed: true, widgets: ['zebra']})
      .tablesorterPager({container: $("#pager"), positionFixed: false});
    });
  </script>
<% end %>

<% form_for(@project_selection) do |f| %>
  <%= f.error_messages %>

<table id="projects" class="tablesorter">
  <thead>
    <th title="Click to sort by project number: click again to reverse sort direction.">Number</th>
    <th title="Click to sort by project title: click again to reverse sort direction.">Title</th>
    <th title="Click to sort by project supervisor: click again to reverse sort direction.">Supervisor</th>
    <th title="Click to sort by research centre: click again to reverse sort direction.">Centre</th>
    <th colspan="2">Select</th>
  </thead>
    <% form_for (@project_selection) do |f| %>
      <tfoot>
        <tr><th colspan="3">&nbsp;</th><th colspan="2"><%= f.submit "Submit selections"  %></th></tr>
      </tfoot>
      <tbody>
        <%= render(:partial => "project_selection_index", :collection => @projects, :locals => {:f => f, :selection => @project_selection}) %>
      </tbody>
    <% end %>
</table>
<%= render(:partial => "shared/tablesorter_pager", :locals => {:pager_id => 'pager'})%>

<% end %>

<%= link_to 'Back', project_selections_path %>